export default {
  install(Vue, options) {
    Vue.prototype.readerHd100 = options => {
      return new Promise((resolve, reject) => {
        try {
          if (global.readerHd100) {
            resolve(global.readerHd100)
          } else {
            const $object = document.createElement('object')
            $object.setAttribute('id', 'HD100')
            $object.setAttribute(
              'classid',
              'clsid:C764203F-6646-46B9-A0D6-0396AC901695'
            )
            $object.setAttribute('width', '0')
            $object.setAttribute('height', '0')
            global.document.body.appendChild($object)
            global.readerHd100 = document.getElementById('HD100')
            resolve(global.readerHd100)
          }
        } catch (e) {
          reject(e)
        }
      })
    }
  }
}
